package com.yuandian.middle.platform.contoller;

import com.yuandian.api.middle_platform.po.OrgAbilityParam;
import com.yuandian.bpm.common.core.util.R;
import com.yuandian.middle.platform.service.IAlarmService;
import com.yuandian.utils.StringUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 说明：告警controller
 * @Author tianlr
 * @Date 2023/5/24 17:06
 */
@Api(value = "alarm", tags = "告警接口")
@RestController
@RequestMapping("/modules/alarm")
public class AlarmController {

    @Autowired
    private IAlarmService alarmService;

    /**
     * 查询告警数据
     * @return
     */
    @PostMapping("/queryDataAlarm")
    @ApiOperation(value = "查询告警数据", notes = "查询告警数据，必填参数：startTime、endTime")
    public R queryDataAlarm(@RequestBody OrgAbilityParam param) {
        if (param == null  || StringUtils.isEmpty(param.getStartTime()) || StringUtils.isEmpty(param.getEndTime())) {
            return R.failed("传入参数不正确！startTime、endTime不能为空");
        }
        return alarmService.selectDataAlarm(param);
    }
}
